Conversation
Added `get_element_names` parameter to `get_native_view` function
TM1py/Services/ViewService.py
Outdated
| return self.get_native_view(cube_name=cube_name, view_name=view_name, private=private) | ||
|
|
||
| def get_native_view(self, cube_name: str, view_name: str, private=False, **kwargs) -> NativeView: | ||
| def get_native_view(self, cube_name: str, view_name: str, private=False, get_element_names: bool = True, **kwargs) -> NativeView: |
There was a problem hiding this comment.
Maybe rename to skip_element_names with default False.
In most other tm1py functions, we use the skip terminology for optional behaviour changes.
|
I realized afterwards that I also wanted to change the Element properties, so I made it so that you can set the element properties. If you don't want the element names, you can pass an empty list. Although it's a little less clear how to exclude names, it's more in line with other parts of TM1py when it comes to object properties and it's more flexible |
I like this. Thank you! please add a test case and we can merge it |
Added test cases for retrieving different element properties
Added element_properties argument to the generic "get" function. For MDXViews, it is ignored
|
I added a test case, and I also added the argument to the generic "get" function (which the test case also tests) |
| self.assertIsInstance(view, NativeView) | ||
| self.assertEqual(view.name, self.native_view_name) | ||
| self.assertIsInstance(native_view, NativeView) | ||
| self.assertEqual(view, native_view) |
There was a problem hiding this comment.
I think here we're not actually testing that the response is different depending on the element_properties provided.
I think it would make sense to create new, separate test cases for common element_properties values.
If we leave this test as is, it will provide good confirmation that the default behavior hasn't changed.
There was a problem hiding this comment.
Oh okay, that makes sense. In that case I may need some help with creating the tests. I am unsure how these self.assert functions work/how to use them for this pull request
Added
get_element_namesparameter toget_native_viewfunction